<%@ tag pageEncoding="UTF-8"%>
<%@ attribute name="page" required="true" type="cn.org.rapid_framework.page.Page" description="Page.java" %>
<%@ attribute name="pageSizeSelectList" type="java.lang.Number[]" required="false"  %>
<%@ attribute name="isShowPageSizeList" type="java.lang.Boolean" required="false"  %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	// set default values
	Integer[] defaultPageSizes = new Integer[]{10,50,100};
	
	if(jspContext.getAttribute("pageSizeSelectList") == null) {
		jspContext.setAttribute("pageSizeSelectList",defaultPageSizes); 
	}
	
	if(jspContext.getAttribute("isShowPageSizeList") == null) {
		jspContext.setAttribute("isShowPageSizeList",true); 
	} 
%>

<!--page-->
<table width="100%"  border="0" cellspacing="0" class="gridToolbar">	
 	 <tr>
		<td>
			<div class="box">
					<div class="leftControls" ></div>			
					<div class="paginationControls">
						<span class="buttonLabel"><s:text name="system.pages.perPage"/></span>
						<c:if test="${isShowPageSizeList}">
						<select onChange="simpleTable.togglePageSize(this.value)">
							<c:forEach var="item" items="${pageSizeSelectList}">
								<option value="${item}" ${page.pageSize == item ? 'selected' : '' }>${item}</option>
							</c:forEach> 
						</select>
						</c:if>
						<span class="buttonLabel"><s:text name="system.pages.item"/> &nbsp; <s:text name="system.pages.total"/> ${page.totalCount} <s:text name="system.pages.itemRecord"/>  &nbsp;  <s:text name="system.pages.No."/></span>
						<span class="pageJump"><input id="jumpPageValue" type="text" class="txt" value="${page.thisPageNumber}"  /><input type="button" value="GO" class="btn" onclick="jumpUserPage()" /></span>
				
						<span class="btn">		
							<c:choose>
							<c:when test="${page.firstPage}"><img src="<c:url value='/images/firstPageDisabled.gif'/>" style="border:0" ></c:when>
							<c:otherwise><a href="javascript:simpleTable.togglePage(1);"><img src="<c:url value='/images/firstPage.gif'/>" style="border:0" ></a></c:otherwise>
							</c:choose>
						</span>
						
						<span class="btn">
							<c:choose>
							<c:when test="${page.hasPreviousPage}"><a href="javascript:simpleTable.togglePage(${page.previousPageNumber});"><img src="<c:url value='/images/prevPage.gif'/>" style="border:0" ></a></c:when>
							<c:otherwise><img src="<c:url value='/images/prevPageDisabled.gif'/>" style="border:0" ></c:otherwise>
							</c:choose>
						</span>
						<c:if test="${page.linkPageNumbers[0]>1}">
						 <em><a href="javascript:simpleTable.togglePage(1);">1</a></em>
						 <span class="pagemore">...</span>
					    </c:if> 
						<c:forEach var="item" items="${page.linkPageNumbers}">
						<c:choose>
						<c:when test="${item == page.thisPageNumber}"><em><a href="javascript:simpleTable.togglePage(${item});" class="on">${item}</a></em></c:when>
						<c:otherwise><em><a href="javascript:simpleTable.togglePage(${item});">${item}</a></em></c:otherwise>
						</c:choose>
						</c:forEach>
						
						<c:if test="${((page.thisPageNumber+4)<page.lastPageNumber) && page.lastPageNumber>10}">
						  <span class="pagemore">...</span>
						</c:if>
						
						<c:if test="${((page.thisPageNumber+4)<page.lastPageNumber) && page.lastPageNumber>10 }">
						  <em><a href="javascript:simpleTable.togglePage(${page.lastPageNumber});">${page.lastPageNumber}</a></em>
						</c:if>
						
						<span class="btn">		
							<c:choose>
							<c:when test="${page.hasNextPage}"><a href="javascript:simpleTable.togglePage(${page.nextPageNumber});"><img src="<c:url value='/images/nextPage.gif'/>" style="border:0" ></a></c:when>
							<c:otherwise><img src="<c:url value='/images/nextPageDisabled.gif'/>" style="border:0" ></c:otherwise>
							</c:choose>
						</span>
						
						<span class="btn">	
							<c:choose>
							<c:when test="${page.lastPage}"><img src="<c:url value='/images/lastPageDisabled.gif'/>" style="border:0"></c:when>
							<c:otherwise><a href="javascript:simpleTable.togglePage(${page.lastPageNumber});"><img src="<c:url value='/images/lastPage.gif'/>" style="border:0" ></a></c:otherwise>
							</c:choose>
						</span>
						
					</div>
			</div>
		</td>
      </tr>
  </table>


